$(function(){
   /* var socket = io.connect("http://127.0.0.1:3300");
    $("#login").on("click",function(){
       alert("登陆");

        var name = $("#username").val();

        socket.emit("login",name);


    });*/

    var socket = io.connect("http://127.0.0.1:8800");
    $("#login").on("click",function(){
        alert("登陆");
        var name = $("#username").val();
        socket.emit("login",name);
    });

    socket.on("islogin",function(data){
        console.log(data);
        if(data){
            $("#dologin").hide();
            $("#chatRoom").show();

            $("#send").on("click",function(){
                var getRole = 123;
                var value = $("#send").val();
                var obj = {};
                obj.getUser = getRole;
                obj.data = value;
                socket.emit("message",obj)

            });
        }
    });

    socket.on("getmsg",function(data){
        console.log(data);
        alert("哈哈哈");

    });

});